#ifndef SENSORTRAYELEVATORCONFIG_H
#define SENSORTRAYELEVATORCONFIG_H

#include "configManager/configobject.h"

class SensorTrayElevatorConfig : public ConfigObject
{
    Q_OBJECT

    Q_PROPERTY(int currentSTIEMag READ currentSTIEMag WRITE setCurrentSTIEMag NOTIFY currentSTIEMagChanged)
    Q_PROPERTY(int currentSTOEMag READ currentSTOEMag WRITE setCurrentSTOEMag NOTIFY currentSTOEMagChanged)
    Q_PROPERTY(int stieMagTrayCount READ stieMagTrayCount WRITE setStieMagTrayCount NOTIFY stieMagTrayCountChanged)
    Q_PROPERTY(int stoeMagTrayCount READ stoeMagTrayCount WRITE setStoeMagTrayCount NOTIFY stoeMagTrayCountChanged)

public:
    enum CurrentMag
    {
        Unknown = 0,
        Mag1,
        Mag2
    };

    SensorTrayElevatorConfig(QObject *parent = nullptr) : ConfigObject(parent)
    {
        init();
    }

    int currentSTIEMag() const
    {
        return m_currentSTIEMag;
    }

    int currentSTOEMag() const
    {
        return m_currentSTOEMag;
    }

    int stieMagTrayCount() const
    {
        return m_stieMagTrayCount;
    }

    int stoeMagTrayCount() const
    {
        return m_stoeMagTrayCount;
    }

public slots:
    void setCurrentSTIEMag(int currentSTIEMag)
    {
        if (m_currentSTIEMag == currentSTIEMag)
            return;

        m_currentSTIEMag = currentSTIEMag;
        emit currentSTIEMagChanged(m_currentSTIEMag);
    }

    void setCurrentSTOEMag(int currentSTOEMag)
    {
        if (m_currentSTOEMag == currentSTOEMag)
            return;

        m_currentSTOEMag = currentSTOEMag;
        emit currentSTOEMagChanged(m_currentSTOEMag);
    }

    void setStieMagTrayCount(int stieMagTrayCount)
    {
        if (m_stieMagTrayCount == stieMagTrayCount)
            return;

        m_stieMagTrayCount = stieMagTrayCount;
        emit stieMagTrayCountChanged(m_stieMagTrayCount);
    }

    void setStoeMagTrayCount(int stoeMagTrayCount)
    {
        if (m_stoeMagTrayCount == stoeMagTrayCount)
            return;

        m_stoeMagTrayCount = stoeMagTrayCount;
        emit stoeMagTrayCountChanged(m_stoeMagTrayCount);
    }

signals:
    void currentSTIEMagChanged(int currentSTIEMag);

    void currentSTOEMagChanged(int currentSTOEMag);

    void stieMagTrayCountChanged(int stieMagTrayCount);

    void stoeMagTrayCountChanged(int stoeMagTrayCount);

private:
    int m_currentSTIEMag = Unknown;
    int m_currentSTOEMag = Unknown;
    int m_stieMagTrayCount = 1;
    int m_stoeMagTrayCount = 1;
};

#endif    // SENSORTRAYELEVATORCONFIG_H
